package com.zhenmyan.secdeal.Enum;

import lombok.Data;

/**
 * description:
 *
 * @author 颜真明
 * @date 2023/5/5  15:17
 */
public enum ResponseEnum {

    // 通用
    SUCCESS(200, "SUCCESS"),
    ERROR(500, "ERROR"),
    // 登录异常
    LOGIN_ERROR(500100, "用户名或者密码不正确"),
    MOBILE_ERROR(500101, "手机号码格式有误！"),
    BIND_EXCEPTION(500102, "参数校验异常"),
    SESSION_ERROR(500103, "用户不存在"),
    // 秒杀模块
    EMPTY_STOCK(500200, "库存不足"),
    REPEAT_ERROR(500201, "该商品每人限购一件"),
    REQUEST_ILLEGAL(500202, "请求非法，请重新尝试"),
    ACCESS_LIMIT_REACHED(500203, "访问过于频繁，请稍后重试"),
    // 订单模块
    ORDER_NOT_EXIST(500300, "订单不存在");

    private int code;
    private String message;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    ResponseEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public static ResponseEnum success() {
        return ResponseEnum.SUCCESS;
    }

    public static ResponseEnum error() {
        return ResponseEnum.ERROR;
    }

}
